﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Presentation
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        DataGridViewComboBoxColumn comboColumn;

        DataTable dt;

        DataTable dt2;
        private void Form1_Load(object sender, EventArgs e)
        {
            dt = new DataTable();

            dt.Columns.Add("comboColumn");

            dt.Columns.Add("col");

            dt.Rows.Add("id1", "abc");

            dt.Rows.Add("id2", "def");



            dt2 = new DataTable();

            dt2.Columns.Add("comboCol");

            dt2.Rows.Add("id1");

            dt2.Rows.Add("id2");



            dataGridViewX1.AutoGenerateColumns = false;

            comboColumn = new DataGridViewComboBoxColumn();

            comboColumn.DataPropertyName = "comboColumn";

            comboColumn.DisplayMember = "comboCol";

            comboColumn.ValueMember = "comboCol";

            comboColumn.DataSource = dt2;




            
            DataGridViewTextBoxColumn textColumn = new DataGridViewTextBoxColumn();

            textColumn.DataPropertyName = "col";

            dataGridViewX1.Columns.Add(comboColumn);

            dataGridViewX1.Columns.Add(textColumn);

            dataGridViewX1.DataSource = dt;
        }
    }
}
